package com.lzwk.app.dwd.ocpx;

import com.lzwk.beans.ocpx.DwdOrder;
import com.lzwk.beans.ocpx.OdsAccountWxuser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * @title: TestBean
 * @Author Yeaser
 * @Date: 2022/4/20 20:24
 * @Version 1.0
 * Description: TODO
 */
@AllArgsConstructor
@Data
@NoArgsConstructor
public class TestBean {

    private Integer id;
    private Timestamp create_time;
    private Timestamp pay_time;
    private Integer wxapp_id;
    private Integer payer_id;
    private Integer paid;
    private Integer account_id;
    private Integer wx_id;
    private Integer subscribe;



    public TestBean(TestOrder testOrder, TestWxuser testWxuser) {
        mergeOrder(testOrder);
        mergeWxuser(testWxuser);
    }

    public TestBean(TestOrder testOrder) {
        mergeOrder(testOrder);
        this.wx_id = -1;
        this.subscribe = 2;
    }

    private void mergeWxuser(TestWxuser testWxuser) {
        this.wx_id = testWxuser.getId();
        this.subscribe = testWxuser.getSubscribed();

    }


    private void mergeOrder(TestOrder testOrder) {

        this.id = testOrder.getId();
        this.create_time = testOrder.getCreate_time();
        this.pay_time = testOrder.getPay_time();
        this.wxapp_id = testOrder.getWxapp_id();
        this.payer_id = testOrder.getPayer_id();
        this.paid = testOrder.getPaid();
        this.account_id = testOrder.getAccount_id();

    }
}
